package com.project.gcsj5.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.gcsj5.mapper.BookMapper;
import com.project.gcsj5.model.Book;
import com.project.gcsj5.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public Book get_a_book(int id) {
        Book comment = bookMapper.get_a_book(id);
        return comment;
    }

    @Override
    public Boolean add_view(int id) {
        Boolean a = bookMapper.add_view(id);
        return a;
    }

    @Override
    public Boolean stars_new(float rate, int id) {
        return bookMapper.stars_new(rate,id);
    }

    @Override
    public List<Book> find_by_category(String category) {
        List<Book> books = bookMapper.find_by_category(category);
        return books;
    }

    @Override
    public List<Book> get_by_content(String content) {
        List<Book> comments = bookMapper.find_by_content(content);
        return comments;
    }
}
